/* * jQuery pinify Plugin v1.2 * http://ie9ify.codeplex.com * * Copyright 2011, Brandon Satrom and Clark Sell * Licensed under MS-PL. * http://ie9ify.codeplex.com/license * * Date: Wednesday May 11 2011 11:47:27 -05 */ (function(d,e){function c(f,h,g){if(d("meta[name="+f+"]").length&&f!=="msapplication-task"){return}if(!h.length){return}d("",{name:f,content:h}).appendTo(g)}function a(){return(!!window.external)&&("msIsSiteMode" in window.external)}var b={init:function(g){var f={applicationName:document.title.toString(),favIcon:"http://"+location.host+"/favicon.ico",navColor:"",startUrl:"http://"+location.host,tooltip:document.title.toString(),window:"width=800;height=600",tasks:[]};g=d.extend({},f,g);return this.each(function(){var i=g.tasks;var h=this;if(d("link[type^=image]").length===0){d("",{rel:"shortcut icon",type:"image/ico",href:g.favIcon}).appendTo(this)}c("application-name",g.applicationName,this);c("msapplication-tooltip",g.tooltip,this);c("msapplication-starturl",g.startUrl,this);c("msapplication-navbutton-color",g.navColor,this);c("msapplication-window",g.window,this);d.each(i,function(j,k){c("msapplication-task","name="+k.name+";action-uri="+k.action+";icon-uri="+k.icon,h)})})},enablePinning:function(f){return this.each(function(){f=f||"Drag this image to your Windows 7 Taskbar to pin this site with IE9";d(this).addClass("msPinSite").attr("title",f)})},enableSiteMode:function(f){f=f||"click";return this.each(function(){d(this).bind(f,function(g){g.preventDefault();try{window.external.msAddSiteMode()}catch(h){}})})},pinTeaser:function(o){if(window.external.msIsSiteMode()){return this}var j=d(this);var i={type:"hangingChad",icon:"http://"+location.host+"/favicon.ico",pinText:"Drag this image to the taskbar to pin this site",secondaryText:"Simply drag the icon or tab to taskbar to pin.",addStartLink:true,linkText:"Click here to add this site to the start menu",sticky:true,timeout:10000,style:{linkColor:"rgb(0, 108, 172)",backgroundColor:"rgb(0, 108, 172)",textColor:"white",backgroundImage:null,leftBackgoundImage:null,rightBackgoundImage:null,closeButtonImage:null}};var m,g,l,f,n,h;var k={topHat:function(){j.addClass("pinify-topHat-container pinify-teaser").css("color",o.style.textColor);if(o.style.backgoundImage){j.css("background-image",o.style.backgroundImage)}m=d("
",{"class":"pinify-topHat-alignment"}).appendTo(j);g=d("
",{"class":"pinify-topHat-content"}).appendTo(m);d("",{id:"pinify-topHat-logo",src:o.icon,alt:"Drag Me","class":"msPinSite"}).appendTo(g);d("").addClass("pinify-topHat-text").text(o.pinText).appendTo(g)},brandedTopHat:function(){j.addClass("pinify-brandedTopHat-container pinify-teaser").css("color",o.style.textColor);if(o.style.backgoundImage){j.css("background-image",o.style.backgroundImage)}g=d("
",{"class":"pinify-brandedTopHat-content"}).appendTo(j);d("",{id:"pinify-brandedTopHat-firstLogo",src:o.icon,alt:"Drag Me","class":"msPinSite"}).appendTo(g);d("",{id:"pinify-brandedTopHat-thirdLogo",src:o.icon,alt:"Drag Me","class":"msPinSite"}).appendTo(g);d("
",{"class":"pinify-mainText"}).text(o.pinText).appendTo(g);d("
",{"class":"pinify-brandedTopHat-secondaryText"}).text(o.secondaryText).appendTo(g)},doubleTopHat:function(){j.addClass("pinify-doubleTopHat-container pinify-teaser").css("color",o.style.textColor);l=d("
",{"class":"pinify-doubleTopHat-left"}).appendTo(j);if(o.style.leftBackgroundImage){d(l).css("background-image",o.style.leftBackgoundImage)}f=d("
",{id:"pinify-doubleTopHat-leftBar"}).appendTo(l);d("",{id:"pinify-doubleTopHat-logo",src:o.icon,alt:"Drag Me","class":"msPinSite"}).appendTo(f);n=d("
",{"class":"pinify-doubleTopHat-right"}).appendTo(j);if(o.style.rightBackgroundImage){d(n).css("background-image",o.style.rightBackgoundImage)}d("
",{id:"pinify-doubleTopHat-rightBar"}).appendTo(n);h=d("
",{id:"pinify-doubleTopHat-rightBarMainContent"}).appendTo(n);d("
",{"class":"pinify-mainText"}).text(o.pinText).appendTo(h);d("
",{"class":"pinify-doubleTopHat-lighterText"}).text(o.secondaryText).appendTo(n)},hangingChad:function(){j.hide();j.css({color:o.style.textColor,"background-color":o.style.backgroundColor}).addClass("pinify-hanging-container pinify-teaser");d("",{src:o.icon,"class":"msPinSite"}).appendTo(j);d("
",{"class":"pinify-hanging-content"}).appendTo(j);d("
",{id:"pinify-pinText"}).text(o.pinText).appendTo(j);j.fadeIn("slow")}};o=d.extend({},i,o);return this.each(function(){k[o.type]();if(!o.sticky){this.delay(o.timeout).fadeOut("slow")}else{d("
").addClass("pinify-closePin").click(function(){d(".pinify-teaser").slideUp("slow");j.slideUp("slow")}).appendTo(j)}if(!o.addStartLink){return}d("").addClass("pinify-addSiteLink").attr("href","#").click(function(p){p.preventDefault();try{window.external.msAddSiteMode()}catch(q){}}).css("color",o.linkColor).appendTo(j).text(o.linkText)})}};d.fn.pinify=function(f){if(!a()){return this}if(b[f]){return b[f].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof f==="object"||!f){return b.init.apply(this,arguments)}else{d.error("Method "+f+" does not exist on jQuery.pinify")}}};d.pinify={};d.pinify.firstRunState=function(f){if(!a()){return 0}if(f){f=false}try{return window.external.msIsSiteModeFirstRun(f)}catch(g){return 0}};d.pinify.isPinned=function(){if(!a()){return false}try{return window.external.msIsSiteMode()}catch(f){return false}};d.pinify.addJumpList=function(h){if(!a()){return this}var f={title:"",items:[]};h=d.extend({},f,h);try{if(window.external.msIsSiteMode()){window.external.msSiteModeClearJumplist();window.external.msSiteModeCreateJumplist(h.title);var g=h.items;d.each(g,function(j,k){window.external.msSiteModeAddJumpListItem(k.name,k.url,k.icon)});window.external.msSiteModeShowJumplist()}}catch(i){}return this};d.pinify.clearJumpList=function(){if(!a()){return this}try{if(window.external.msIsSiteMode()){window.external.msSiteModeClearJumpList()}}catch(f){}};d.pinify.addOverlay=function(g){if(!a()){return this}var f={eventName:"click",title:"",icon:""};g=d.extend({},f,g);try{if(window.external.msIsSiteMode()){window.external.msSiteModeClearIconOverlay();window.external.msSiteModeSetIconOverlay(g.icon,g.title)}}catch(h){}};d.pinify.clearOverlay=function(){if(!a()){return this}try{if(window.external.msIsSiteMode()){window.external.msSiteModeClearIconOverlay()}}catch(f){}};d.pinify.flashTaskbar=function(f){if(!a()){return this}try{if(window.external.msIsSiteMode()){window.external.msSiteModeActivate()}}catch(g){}};d.pinify.createThumbbarButtons=function(i){if(!a()){return this}var g={buttons:[]};i=d.extend({},g,i);try{if(window.external.msIsSiteMode()){var j=[];var f=function(){};f.prototype.button=null;f.prototype.alternateStyle=null;f.prototype.activeStyle=0;f.prototype.click=null;var h=function(l){var n=j[l.buttonID];n.click();if(n.alternateStyle){var m=n.activeStyle===0?n.alternateStyle:0;window.external.msSiteModeShowButtonStyle(n.button,m);n.activeStyle=m}};d.each(i.buttons,function(m,p){var l=window.external.msSiteModeAddThumbBarButton(p.icon,p.name);var o;if(p.alternateStyle){var n=p.alternateStyle;o=window.external.msSiteModeAddButtonStyle(l,n.icon,n.name)}var q=new f();q.button=l;q.alternateStyle=o;q.click=p.click;j[l]=q;document.addEventListener("msthumbnailclick",h,false)});window.onunload=function(){var l;for(l in j){if(j.hasOwnProperty(l)){window.external.msSiteModeUpdateThumbBarButton(j[l].button,true,false)}}};window.onload=function(){var l;for(l in j){if(j.hasOwnProperty(l)){window.external.msSiteModeUpdateThumbBarButton(j[l].button,true,true)}}};window.external.msSiteModeShowThumbBar()}}catch(k){}}})(jQuery);